
function first(){
    let right_number=0;
    if(document.getElementById("one").value=="统一建模语言"){
      right_number++;
    }
    if(document.getElementById("two").value=="封装性"){
      right_number++;
    }
    if(document.getElementById("three").value=="继承性"){
      right_number++;
    }
    if(document.getElementById("four").value=="多态性"){
      right_number++;
    }
    let score=right_number*5;
    return score;
  }

  function second(){
      let right_number=0;
      let radio1=document.getElementsByName("question_2_1");
      for(let i=0;i<radio1.length;i++){
          if(radio1[i].checked){
              if(radio1[i].value=="right"){
                  right_number++;
              }
          }
      }
      let radio2=document.getElementsByName("question_2_2");
      for(let i=0;i<radio2.length;i++){
          if(radio2[i].checked){
              if(radio2[i].value=="right"){
                  right_number++;
              }
          }
      }
      let score=right_number*10;
      return score;
  }

  function third(){
      let right_number=0;
      let checkbox1=document.getElementsByName("question_3_1");
      let num1=0;
      for(let i=0;i<checkbox1.length;i++){
          if(checkbox1[i].checked){
              if(checkbox1[i].value=="right"){
                  num1++;
              }
          }
      }
      if(num1==3){
          right_number++;
      }
      let checkbox2=document.getElementsByName("question_3_2");
      let num2=0;
      for(let i=0;i<checkbox2.length;i++){
          if(checkbox2[i].checked){
              if(checkbox2[i].value=="right"){
                  num2++;
              }
          }
      }
      if(num2==3){
          right_number++;
      }
      let score=right_number*10;
      return score;
  }

  function fourth(){
    let right_number=0;
    let radio1=document.getElementsByName("question_4_1");
    for(let i=0;i<radio1.length;i++){
        if(radio1[i].checked){
            if(radio1[i].value=="right"){
                right_number++;
            }
        }
    }
    let radio2=document.getElementsByName("question_4_2");
    for(let i=0;i<radio2.length;i++){
        if(radio2[i].checked){
            if(radio2[i].value=="right"){
                right_number++;
            }
        }
    }
    let score=right_number*10;
    return score;
  }

  function fifth(){
      if(document.getElementsByName("question_5_1").value=="模型是对现实世界的简化和抽象，模型是对所研究的系统、过程、事物或概念的一种表达形事，可以是物理实体；可以是某种图形；或者是一种数学表达式。"){
          return 20;
      }
      else{
          return 0;
      }
  }

  function calculate_score(){
      let class1=document.getElementById("class").value;
      let student_ID=document.getElementById("student_ID").value;
      let name=document.getElementById("name").value;
      let score=first()+second()+third()+fourth()+fifth();
      //alert("班级");
      alert("班级："+class1+"  学号："+student_ID+"  姓名："+name+"\n"+"分数："+score);
  }